package com.lepu.app.fun.health.activity;

import java.util.ArrayList;

import android.os.Bundle;
import android.widget.ListView;

import com.app.utils.UmengEvent;
import com.core.lib.application.BaseFragmentActivity;
import com.core.lib.utils.main.UmengHelper;
import com.lepu.app.fun.health.adapter.MoreDurgAdapter;
import com.lepu.app.fun.health.bean.BeanDurg.TopDurg;
import com.lepu.app.widget.CustomTopBarNew;
import com.lepu.app.widget.CustomTopBarNew.OnTopbarNewLeftLayoutListener;
import com.lepu.pasm.R;

public class MoreDurgActivity extends BaseFragmentActivity implements
		OnTopbarNewLeftLayoutListener {

	private ListView mListView;
	private ArrayList<TopDurg> mDurgList;
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.health_more_durg_activity);

		init();
	}

	public void onResume() {
		super.onResume();

		UmengHelper.onResume(this, UmengEvent.page_gengduoyaopin);
	}

	@Override
	public void onPause() {
		super.onPause();

		UmengHelper.onPause(this, UmengEvent.page_gengduoyaopin);
	}

	@Override
	public void onDestroy() {
		super.onDestroy();
	}

	/**
	 * 添加页面动画，需要重写这个方法，
	 */
	@Override
	public void onBackPressed() {
		finish(true);
	}
	
	@Override
	public void onTopbarLeftLayoutSelected() {
		finish(true);
	}

	/**
	 * 初始化方法
	 */
	@SuppressWarnings("unchecked")
	private void init() {
		UmengHelper.CustomEvent(this, UmengEvent.event_fuwu_kuaisuzixun_gengduoyaopin);
		// topbar
		CustomTopBarNew topbar = (CustomTopBarNew) findViewById(R.id.topbar);
		topbar.setTopbarTitle("推荐药品");
		topbar.setonTopbarNewLeftLayoutListener(this);
		
		mListView = (ListView) findViewById(R.id.listView);
		mDurgList = new ArrayList<>();
		
		Bundle bundle = getIntent().getExtras();
		if(bundle != null && bundle.size() > 0){
			mDurgList = (ArrayList<TopDurg>) bundle.getSerializable("MedicineList");
		}
		
		MoreDurgAdapter adapter = new MoreDurgAdapter(MoreDurgActivity.this, mDurgList);
		mListView.setAdapter(adapter);
	}

	

}
